#ifndef __KHTABLE_H_
#define __KHTABLE_H_

#include <linux/list.h>

#define KH_HAS_INIT 1

/*
 * A key-value pair.
 */
struct kv_pair {
	char *value;
	//size_t vsize;

	char *key;
	//size_t ksize;
};

/*
 * A node in a hlist.  Contains a key-value pair.
 */
struct kh_node {
	struct hlist_node hl_node;
	struct kv_pair kvpair;
};

/*
 * A hash table head node.
 * @record_cnt: the count of record in hash table.
 * @ht_entry: which pointed to hash table's entry address.
 * @bucket_cnt_index: the index of prime table, the COUNT of bucket
 *                     is prime_table[bucket_cnt_index].
 * @init_flag: only init_flag = KH_HAS_INIT, it's mean hash table initialized. 
 */
struct kh_table_head {
	uint64_t record_cnt;
	struct hlist_head *entry;
	uint32_t bucket_cnt_index;
	unsigned char init_flag;
};

#endif
